package com.cu.employmentmanagementsystem.handler;

import com.cu.employmentmanagementsystem.common.enums.WxChatMsgTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

@Slf4j
@Component
public class SubscribeMsgHandler implements WxChatMsgHandler
{
    @Override
    public WxChatMsgTypeEnum getChatMsgType()
    {
        return WxChatMsgTypeEnum.SUBSCRIBE;
    }

    @Override
    public String dealMsg(Map<String,String> messageMap)
    {
        log.info("用户关注");
        String content = "<xml>\n" +
                "  <ToUserName><![CDATA["+messageMap.get("FromUserName")+"]]></ToUserName>\n" +
                "  <FromUserName><![CDATA["+messageMap.get("ToUserName")+"]]></FromUserName>\n" +
                "  <CreateTime>12345678</CreateTime>\n" +
                "  <MsgType><![CDATA[text]]></MsgType>\n" +
                "  <Content><![CDATA[我叫宇宙大队长，欢迎你关注我！]]></Content>\n" +
                "</xml>";

        return content;
    }
}
